package tech.aistar.corejava.day02;

/**
 * @author success
 * @version 1.0
 * @description:本类用来演示:
 * @date 2019/7/16 0016
 */
public class SwitchCaseDemo {
    public static void main(String[] args) {
        //定义年份
        int year = 2012;
        //定义月份
        int month = 2;

        //定义天数
        int maxDays = -1;

        //根据分数的区间来实现显示的内容
        //[90-100] - 优秀
        //[80-90) - 良好

        switch (month){
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                maxDays = 31;
                break;
            case 2:
                maxDays = (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0) ? 29: 28;
                break;
            default:
                maxDays = 30;
                break;
        }

        System.out.println(year+"年"+month+"月,最大天数是:"+maxDays);
    }
}
